<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>动态绑定 class 属性 ——三目运算符语法</title>
    <style>
        .colordecorate {
            color: red;
        }

        .textdecorate {
            text-decoration: underline;
        }
    </style>
</head>
<body>
<div id="app">
    <h1 class="colordecorate">Hello, World!</h1>

    <!--  将数据对象的定义放到 js 中  -->
    <!--  三目运算符语法：布尔类型变量?值为真返回的类:值为假返回的类  -->
    <h1 v-bind:class="isTextDecorated? 'textdecorate':''">Hello, World!</h1>
    <h1 v-bind:class="isColorDecorated? 'colordecorate':''">Hello, World!</h1>


</div>
<script type="module">

    import {createApp} from "../../../../../js/vue.esm-browser.js";

    const app = createApp({
        setup() {
            let isTextDecorated = true
            let isColorDecorated = true
            return {
                isTextDecorated,
                isColorDecorated,

            }
        }
    })
    app.mount("#app")
</script>
</body>
</html>